package com.salton123.revenue

import android.app.Activity
import com.salton123.provider.IRevenueProvider
import com.salton123.utils.task.ThreadQueue
import java.util.*

/**
 * Time:2022/3/10 12:30 下午
 * Author:
 * Description:
 */
class RewardAdsDisplayer(providers: LinkedList<IRevenueProvider>) {
    private val tempProviders: LinkedList<IRevenueProvider> = LinkedList()

    init {
        this.tempProviders.addAll(providers)
    }

    fun show(activity: Activity) {
        ThreadQueue.postOnUi {
            tempProviders.poll()?.showRewarded(activity) {
                if (!it) {
                    show(activity)
                }
            }
        }
    }
}